package com.dongdong.bookstore.common.exception;

import com.dongdong.bookstore.common.api.IReturnCode;

/**
 * @author chiangkai
 * @date 2021-10-14
 * @email chiangkk@163.com
 */
public class ApiException extends RuntimeException {

    public ApiException(String message) {
        super(message);
    }

    private IReturnCode returnCode;

    public ApiException(IReturnCode returnCode) {
        super(returnCode.getMessage());
        this.returnCode = returnCode;
    }

    public ApiException(Throwable cause) {
        super(cause);
    }

    public IReturnCode getReturnCode() {
        return returnCode;
    }

    public ApiException(String message, Throwable cause) {
        super(message, cause);
    }
}
